Dynomotion

Group: DynoMotion Message: 14250 From: Hardy Family Date: 12/8/2016
Subject: Some problems getting jog shuttle working.
Hi Tom,

I basically have jog shuttle mode working, but there are a few things I don't understand:

1.  When user enables shuttle mode while a job is running, it does a harsh stop.  I am using the following function when entering shuttle mode:

void SetFROTemp(float FRO); // Temporarily change from current to the specified FRO using a nominal rate, override FeedHold, don't save as LastFRO 

with a zero parameter.  So how do you define the "nominal rate" of deceleration?  What field in the channel struct is it using?  All our axes have proper acceleration values defined (work fine with g0 moves etc.) but this function seems to use much higher deceleration.

I realize we could use SetFROwRateTemp() to explicitly set something, but curious as to what is going on with the simpler function.

2.  While in jog shuttle mode, the user also presses feed hold.  When the user exits jog shuttle mode, the coordinated motion creeps forward very slowly (maybe about 1/100 of real time), not stopped like one would expect.

So there must be something I don't understand with the interaction of using SetFROTemp() locally on the kflop, and the PC sending feed hold commands.

Any insight would be appreciated.

Regards,
SJH

Group: DynoMotion Message: 14252 From: Tom Kerekes Date: 12/9/2016
Subject: Re: Some problems getting jog shuttle working.

Hi SJH,

I'm not sure what you mean by Jog Shuttle Mode?  What happens when the user "exits jog shuttle mode"?

Below is the code used to determine how quickly the Axis will be stopped.  This function is called within SetFROTemp() for each axis in the Coordinate System to determine the Maximum required time that could be required for any axis.  Its only an approximation because feedhold works by linearly ramping down the "rate of time".

float MaxDecelTimeForAxis(int axis)
{
    CHAN *ch = &chan[axis];

    if (axis==-1) return 0.0f;

    // include jerk time as cushion because we won't be limiting jerk
    return (ch->Vel / ch->Accel) + sqrtf(8.0f * ch->Vel/ch->Jerk); 
}

Regards

TK


On 12/8/2016 7:42 PM, Hardy Family hardy.woodland.cypress@... [DynoMotion] wrote:
 
Hi Tom,

I basically have jog shuttle mode working, but there are a few things I don't understand:

1.  When user enables shuttle mode while a job is running, it does a harsh stop.  I am using the following function when entering shuttle mode:

void SetFROTemp(float FRO); // Temporarily change from current to the specified FRO using a nominal rate, override FeedHold, don't save as LastFRO 

with a zero parameter.  So how do you define the "nominal rate" of deceleration?  What field in the channel struct is it using?  All our axes have proper acceleration values defined (work fine with g0 moves etc.) but this function seems to use much higher deceleration.

I realize we could use SetFROwRateTemp() to explicitly set something, but curious as to what is going on with the simpler function.

2.  While in jog shuttle mode, the user also presses feed hold.  When the user exits jog shuttle mode, the coordinated motion creeps forward very slowly (maybe about 1/100 of real time), not stopped like one would expect.

So there must be something I don't understand with the interaction of using SetFROTemp() locally on the kflop, and the PC sending feed hold commands.

Any insight would be appreciated.

Regards,
SJH


Group: DynoMotion Message: 14253 From: Hardy Family Date: 12/9/2016
Subject: Re: Some problems getting jog shuttle working.
Sorry I should have made that clearer.

Jog shuttle is where the motion through the coordinated motion buffer is regulated by the user turning the MPG wheel when selecting the (otherwise unused) C axis.  Some time back I had a thread asking how to do this.

Basically, it sets a "target time point" in the coordinated motion buffer, then uses SetFROwRateTemp() to servo the actual time point (CS0_TimeExecuted + CS0_t) towards the target, using an exponential approach.

When exiting jog shuttle mode, it does

    SetFRO(CS0_LastFRO);
    SetRapidFRO(CS0_LastRapidFRO);

so I'm assuming that the LastFRO values are not being touched while in shuttle mode, since it uses all the "temp" FRO functions.

Anyway, here's the relevant code.  It depends on stuff that's not included, but you should get the idea.

shuttle_init() is called when user enters shuttle mode, and shuttle_terminate() on exit.

jog_shuttle() is called when the MPG wheel is rotated.

shuttle_fb_loop() is called continuously when in shuttle mode.

Regards,
SJH


// Shuttle state
struct {
    double target;      // Target exec time
    double exp_intvl;   // Real-time interval over which FRO is reduced when approaching target time.
    double windup;      // Max "windup": shuttle wheel ahead/behind current exp_intvl.
    double max_fro;     // Max FRO when following shuttle
    int lock;           // If true, force FRO to 0
} shs;


static void shuttle_init()
{
    mpg_parms_t * mp = get_mpg_parms();
    general_parms_t * gp = get_general_parms();
   
    shs.exp_intvl = 0.15;
    shs.windup = 0.2;
    shs.max_fro = mp->shuttle_max_fro;
    // Stop everything gracefully
    SetFROTemp(0.);
    shs.lock = 1;
    CS0_HoldAtEnd = ((int)gp->options & SHUTTLE_HOLD) != 0;
    if (supe->machine_options & MO_VERBOSE_MPG)
        printf("MPG shuttle mode started exec=%12.3f t=%12.3f lost=%12.3f\n", CS0_TimeExecuted, CS0_t, CS0_TimeLost);
}

static void shuttle_terminate()
{
    SetFRO(CS0_LastFRO);
    SetRapidFRO(CS0_LastRapidFRO);
    shs.lock = 0;
    CS0_HoldAtEnd = 0;
    if (supe->machine_options & MO_VERBOSE_MPG)
        printf("MPG shuttle mode terminated\n");
}

// dp*steps is MPG increment times "zoom factor".

static void jog_shuttle(double dp, double steps)
{
    double t, et, max_t, min_t;
   
    // If being called for 'C' axis, but not in shuttle mode, then just wait a tick and return.
    if (!(VAR_JOG_FLAGS & JOG_SHUTTLE)) {
        WaitNextTimeSlice();
        return;
    }

    et = CS0_TimeExecuted + CS0_t;
   
    if (shs.lock && CS0_TimeExecuted < CS0_TimeDownloaded) {
        shs.target = et;
        shs.lock = 0;       
        if (supe->machine_options & MO_VERBOSE_MPG)
            printf("MPG shuttle mode unlocked exec=%12.3f t=%12.3f lost=%12.3f\n", CS0_TimeExecuted, CS0_t, CS0_TimeLost);
    }
   
    t = shs.target + dp*steps;
    max_t = CS0_TimeDownloaded;
    min_t = CS0_TimeLost;
    if (max_t > et + shs.windup)
        max_t = et + shs.windup;
    if (min_t < et - shs.windup)
        min_t = et - shs.windup;
    if (t > max_t)
        t = max_t;
    else if (t < min_t)
        t = min_t;
    shs.target = t;
    //if (supe->machine_options & MO_VERBOSE_MPG)
    //    printf("MPG shuttle target=%12.3f\n", shs.target);
    WaitNextTimeSlice();
}

static void shuttle_fb_loop()
{
    // Called while shuttle mode enabled, to drive the FRO in such a way as to approach the
    // target execution time.
    double t = CS0_TimeExecuted + CS0_t;
    double dt = shs.target - t;
    float fro = dt / shs.exp_intvl;

    if (!shs.lock && CS0_TimeExecuted >= CS0_TimeDownloaded) {
        shs.lock = 1;
        if (supe->machine_options & MO_VERBOSE_MPG)
            printf("MPG shuttle mode locked (buffer done at %12.3f)\n", CS0_TimeExecuted);
    }

    if (shs.lock)
        fro = 0.;
    else {
        if (fro > shs.max_fro)
            fro = shs.max_fro;
        else if (fro < -shs.max_fro)
            fro = -shs.max_fro;
        fro = sqrt(fast_fabs(fro)) * (fro<0?-1.:1.);  // sqrt so that we use real-time interval,
                                                      // not expanded time (otherwise too sluggish)
    }
    SetFROwRateTemp(fro, fast_fabs(shs.exp_intvl*fro));
}


On Fri, Dec 9, 2016 at 12:19 PM, Tom Kerekes tk@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
 

Hi SJH,

I'm not sure what you mean by Jog Shuttle Mode?  What happens when the user "exits jog shuttle mode"?

Below is the code used to determine how quickly the Axis will be stopped.  This function is called within SetFROTemp() for each axis in the Coordinate System to determine the Maximum required time that could be required for any axis.  Its only an approximation because feedhold works by linearly ramping down the "rate of time".

float MaxDecelTimeForAxis(int axis)
{
    CHAN *ch = &chan[axis];

    if (axis==-1) return 0.0f;

    // include jerk time as cushion because we won't be limiting jerk
    return (ch->Vel / ch->Accel) + sqrtf(8.0f * ch->Vel/ch->Jerk); 
}

Regards

TK


On 12/8/2016 7:42 PM, Hardy Family hardy.woodland.cypress@gmail. com [DynoMotion] wrote:
 
Hi Tom,

I basically have jog shuttle mode working, but there are a few things I don't understand:

1.  When user enables shuttle mode while a job is running, it does a harsh stop.  I am using the following function when entering shuttle mode:

void SetFROTemp(float FRO); // Temporarily change from current to the specified FRO using a nominal rate, override FeedHold, don't save as LastFRO 

with a zero parameter.  So how do you define the "nominal rate" of deceleration?  What field in the channel struct is it using?  All our axes have proper acceleration values defined (work fine with g0 moves etc.) but this function seems to use much higher deceleration.

I realize we could use SetFROwRateTemp() to explicitly set something, but curious as to what is going on with the simpler function.

2.  While in jog shuttle mode, the user also presses feed hold.  When the user exits jog shuttle mode, the coordinated motion creeps forward very slowly (maybe about 1/100 of real time), not stopped like one would expect.

So there must be something I don't understand with the interaction of using SetFROTemp() locally on the kflop, and the PC sending feed hold commands.

Any insight would be appreciated.

Regards,
SJH



Group: DynoMotion Message: 14277 From: Hardy Family Date: 12/14/2016
Subject: Re: Some problems getting jog shuttle working.
So any insight regarding this issue?  I added some info in message 3 of this thread, but not sure whether it got through.

Regards,
SJH


On Sun, Dec 11, 2016 at 10:49 AM, Tom Kerekes tk@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
 

Heh heh.  Sorry we've been under attack recently.  We've been able to block most of them but this one got through.

Regards

TK


On 12/11/2016 7:51 AM, Hardy Family hardy.woodland.cypress@gmail. com [DynoMotion] wrote:
 
Is it just me, or are the Russians hacking Dynomotion too?


On Sat, Dec 10, 2016 at 1:32 AM, g_avery@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
 


------------------------------ --------------
On Sat, 12/10/16, dansereauruth@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:

Subject: Re: [DynoMotion] Some problems getting jog shuttle working.
To: DynoMotion@yahoogroups.com
Date: Saturday, December 10, 2016, 11:03 AM




 











------------------------------ --------------

On Fri, 12/9/16, thackerkendrick@... [DynoMotion]
<DynoMotion@yahoogroups.com> wrote:



Subject: Re: [DynoMotion] Some problems getting jog shuttle
working.

To: DynoMotion@yahoogroups.com

Date: Friday, December 9, 2016, 11:09 PM





 























------------------------------ --------------



On Fri, 12/9/16, Hardy Family

hardy.woodland.cypress@gmail.c om [DynoMotion]

<DynoMotion@yahoogroups.com> wrote:







Subject: Re: [DynoMotion] Some problems getting jog
shuttle

working.



To: DynoMotion@yahoogroups.com



Date: Friday, December 9, 2016, 10:46 PM











 







































Sorry I



should have made that clearer.







Jog shuttle is where the motion through



the coordinated motion buffer is regulated by the user



turning the MPG wheel when selecting the (otherwise

unused)



C axis.  Some time back I had a thread asking how to
do



this.







Basically, it



sets a "target time point" in the coordinated



motion buffer, then uses SetFROwRateTemp() to servo the



actual time point (CS0_TimeExecuted + CS0_t) towards
the



target, using an exponential approach.







When exiting jog shuttle mode, it does







    SetFRO(CS0_LastFRO);



    SetRapidFRO(CS0_LastRapidFRO);







so I'm assuming that



the LastFRO values are not being touched while in

shuttle



mode, since it uses all the "temp" FRO



functions.







Anyway,



here's the relevant code.  It depends on stuff



that's not included, but you should get the idea.







shuttle_init() is



called when user enters shuttle mode, and



shuttle_terminate() on exit.







jog_shuttle() is called when the MPG



wheel is rotated.







shuttle_fb_loop() is called



continuously when in shuttle mode.







Regards,



SJH











// Shuttle state



struct {



    double target;      // Target exec



time



    double exp_intvl;   //



Real-time interval over which FRO is reduced when



approaching target time.



    double



windup;      // Max "windup": shuttle

wheel



ahead/behind current exp_intvl.



   



double max_fro;     // Max FRO when following

shuttle



    int lock;           // If



true, force FRO to 0



} shs;











static void



shuttle_init()



{



   



mpg_parms_t * mp = get_mpg_parms();



   



general_parms_t * gp = get_general_parms();



   



    shs.exp_intvl =



0.15;



    shs.windup = 0.2;



    shs.max_fro = mp->shuttle_max_fro;



    // Stop everything gracefully



    SetFROTemp(0.);



   



shs.lock = 1;



    CS0_HoldAtEnd =



((int)gp->options & SHUTTLE_HOLD) != 0;



    if (supe->machine_options &



MO_VERBOSE_MPG)



       



printf("MPG shuttle mode started exec=%12.3f

t=%12.3f



lost=%12.3f\n", CS0_TimeExecuted, CS0_t,



CS0_TimeLost);



}







static void shuttle_terminate()



{



   



SetFRO(CS0_LastFRO);



   



SetRapidFRO(CS0_LastRapidFRO);



   



shs.lock = 0;



    CS0_HoldAtEnd = 0;



    if (supe->machine_options &



MO_VERBOSE_MPG)



       



printf("MPG shuttle mode terminated\n");



}







// dp*steps is MPG



increment times "zoom factor".







static void jog_shuttle(double dp, double



steps)



{



    double t,



et, max_t, min_t;



   



    // If being called for 'C' axis,



but not in shuttle mode, then just wait a tick and



return.



    if (!(VAR_JOG_FLAGS &



JOG_SHUTTLE)) {



       



WaitNextTimeSlice();



       



return;



    }







    et = CS0_TimeExecuted + CS0_t;



   



    if (shs.lock



&& CS0_TimeExecuted < CS0_TimeDownloaded) {



        shs.target = et;



        shs.lock = 0;       



        if (supe->machine_options



& MO_VERBOSE_MPG)



           



printf("MPG shuttle mode unlocked exec=%12.3f

t=%12.3f



lost=%12.3f\n", CS0_TimeExecuted, CS0_t,



CS0_TimeLost);



    }



   



    t = shs.target +



dp*steps;



    max_t =



CS0_TimeDownloaded;



    min_t =



CS0_TimeLost;



    if (max_t > et +



shs.windup)



        max_t = et +



shs.windup;



    if (min_t < et -



shs.windup)



        min_t = et -



shs.windup;



    if (t > max_t)



        t = max_t;



    else if (t < min_t)



        t = min_t;



    shs.target = t;



   



//if (supe->machine_options & MO_VERBOSE_MPG)



    //    printf("MPG shuttle



target=%12.3f\n", shs.target);



    WaitNextTimeSlice();



}







static void



shuttle_fb_loop()



{



   



// Called while shuttle mode enabled, to drive the FRO

in



such a way as to approach the



    //



target execution time.



    double t =



CS0_TimeExecuted + CS0_t;



    double dt =



shs.target - t;



    float fro = dt /



shs.exp_intvl;







    if



(!shs.lock && CS0_TimeExecuted >=



CS0_TimeDownloaded) {



       



shs.lock = 1;



        if



(supe->machine_options & MO_VERBOSE_MPG)



            printf("MPG shuttle



mode locked (buffer done at %12.3f)\n",



CS0_TimeExecuted);



    }







    if (shs.lock)



        fro = 0.;



   



else {



        if (fro >



shs.max_fro)



            fro =



shs.max_fro;



        else if (fro



< -shs.max_fro)



           



fro = -shs.max_fro;



        fro =



sqrt(fast_fabs(fro)) * (fro<0?-1.:1.);  // sqrt so

that



we use real-time interval,



           



                                   
 

 



  // not expanded time (otherwise too sluggish)



    }



   



SetFROwRateTemp(fro, fast_fabs(shs.exp_intvl*fro));



}











On Fri, Dec 9, 2016 at



12:19 PM, Tom Kerekes tk@...



[DynoMotion] <DynoMotion@yahoogroups.com>



wrote:































































 



















































Hi SJH,



I'm not sure what you mean by Jog Shuttle

Mode? 



What happens



when the user "exits jog shuttle mode"?











Below is the code used to determine how quickly the



Axis will be



stopped.  This function is called within

SetFROTemp()



for each



axis in the Coordinate System to determine the

Maximum



required



time that could be required for any axis.  Its

only



an



approximation because feedhold works by linearly



ramping down the



"rate of time".











float MaxDecelTimeForAxis(int axis)







{







    CHAN *ch = &chan[axis];















    if (axis==-1) return 0.0f;















    // include jerk time as cushion because we



won't be limiting



jerk







    return (ch->Vel / ch->Accel) +

sqrtf(8.0f



*



ch->Vel/ch->Jerk); 







}



Regards



TK



















On



12/8/2016 7:42 PM, Hardy Family



hardy.woodland.cypress@gmail.



com [DynoMotion] wrote:











 



























Hi Tom,



















I basically have jog shuttle mode



working, but there



are a few things I don't



understand:



















1.  When user enables shuttle mode

while



a job is



running, it does a harsh stop.  I am



using the



following function when entering

shuttle



mode:















void SetFROTemp(float FRO); //

Temporarily



change from



current to the specified FRO using a



nominal rate,



override FeedHold, don't save as



LastFRO 























with a zero parameter.  So how do you



define the



"nominal rate" of

deceleration? 



What field in the



channel struct is it using?  All our

axes



have proper


(Message over 64 KB, truncated)
Group: DynoMotion Message: 14278 From: Tom Kerekes Date: 12/14/2016
Subject: Re: Some problems getting jog shuttle working.

Hi SJH,

Sorry I missed that. 

I don't see anything obviously wrong.  Please print out the FRO values that you are setting on termination as well as all the CS0_xxxx variables so we can understand what went wrong.  Also the CS0_xxx variables when the system is in the 1/100th speed mode?

I also am having a hard time understanding your overall sequence of events.

Regards

TK



On 12/14/2016 2:56 PM, Hardy Family hardy.woodland.cypress@... [DynoMotion] wrote:
 
So any insight regarding this issue?  I added some info in message 3 of this thread, but not sure whether it got through.

Regards,
SJH



Group: DynoMotion Message: 14285 From: Hardy Family Date: 12/17/2016
Subject: Re: Some problems getting jog shuttle working.
I added a function which prints out all the CS0_ state.

Sequence of events: there is a main loop running in thread 7 which is responsible for handling the MPG controls.  When the user application enters/exits jog shuttle mode, it runs a small program in thread 1 to set some bits in shared memory that the main loop can access.  When the "enable shuttle" bit is first set, then it runs shuttle_init().  When the bit is cleared, it runs shuttle_terminate().  When enabled, it calls the control loop shuttle_fb_loop() every tick.  When the user rotates the shuttle wheel, it calls jog_shuttle() with each increment.

Here is the console log when I am running some g-code, start jog shuttle mode, press feed-hold, shuttle the program slightly, then exit shuttle mode.  Result is that program creeps forward very slowly (actually, I think it's backwards because the time base is left negative). 

I print the CS0 states at the start and end of the shuttle_init() and shuttle_terminate() functions.

I have my FRO set to 25% which is why the time base starts at 22.5us.  No qualitative difference is observed with normal 100% rate etc.

Turning on shuttle mode while program running (axes in motion):

+     0 k: CS0 state: shuttle_init (start)
+     0 k:   t=0.390783 TimeExecuted=31.024153 TimeDownloaded=33.642973 TimeLost=0.000000
+     0 k:   TimeBase=22.500000us TimeBaseDelta=0.041021us DecelTime=0.000001 TimeBaseDesired=22.500000us
+     0 k:   DoingRapid=0 Flushed=0 HoldAtEnd=0 NomDecel2TB2=12188868.000000
+     0 k:   StoppingState=0 LastFRO=0.250000 LastRapidFRO=1.000000
+     0 k: MPG shuttle mode started exec=      31.024 t=       0.392 lost=       0.000
+     0 k: CS0 state: shuttle_init (end)
+     0 k:   t=0.392440 TimeExecuted=31.024153 TimeDownloaded=33.642973 TimeLost=0.000000
+     0 k:   TimeBase=21.105285us TimeBaseDelta=0.041021us DecelTime=0.000001 TimeBaseDesired=0.000000us
+     0 k:   DoingRapid=0 Flushed=0 HoldAtEnd=0 NomDecel2TB2=12188868.000000
+     0 k:   StoppingState=0 LastFRO=0.250000 LastRapidFRO=1.000000
+     0 k: MPG jog enabled for 0x20 map_rotary=0 shuttle=1

this message when turning the shuttle wheel:

+   411 k: MPG shuttle mode unlocked exec=      31.024 t=       0.394 lost=       0.000

turning off shuttle mode:

+    87 k: CS0 state: shuttle_terminate (start)
+     0 k:   t=0.403802 TimeExecuted=31.024153 TimeDownloaded=33.642973 TimeLost=0.000000
+     0 k:   TimeBase=-0.132272us TimeBaseDelta=36.742346us DecelTime=0.000001 TimeBaseDesired=-0.132272us
+     0 k:   DoingRapid=0 Flushed=0 HoldAtEnd=0 NomDecel2TB2=12188868.000000
+     0 k:   StoppingState=3 LastFRO=0.250000 LastRapidFRO=1.000000
+     0 k: MPG shuttle mode terminated
+     0 k: CS0 state: shuttle_terminate (end)
+     0 k:   t=0.403794 TimeExecuted=31.024153 TimeDownloaded=33.642973 TimeLost=0.000000
+     0 k:   TimeBase=-0.132272us TimeBaseDelta=0.041021us DecelTime=0.000001 TimeBaseDesired=-0.132272us
+     0 k:   DoingRapid=0 Flushed=0 HoldAtEnd=0 NomDecel2TB2=12188868.000000
+     0 k:   StoppingState=3 LastFRO=0.250000 LastRapidFRO=1.000000

Note that CS0_TimeBase[Desired] seems to be left at a small negative value, whether I shuttle forward or back.  Maybe I should look at StoppingState and force TimeBase to 0 based on that?

If I do all of the above except that I do not actually rotate the shuttle control, then it remembers the feed hold exactly and does not creep forward.  Also, CS0_StoppingState will be at 1 instead of 3.

Here is the log (at shuttle termination) for that case:

+     0 k: CS0 state: shuttle_terminate (start)
+     1 k:   t=0.000268 TimeExecuted=32.495906 TimeDownloaded=33.996697 TimeLost=0.000000
+     0 k:   TimeBase=0.000000us TimeBaseDelta=8100.000020us DecelTime=0.000001 TimeBaseDesired=0.000000us
+     0 k:   DoingRapid=0 Flushed=0 HoldAtEnd=0 NomDecel2TB2=12188868.000000
+     0 k:   StoppingState=1 LastFRO=0.250000 LastRapidFRO=1.000000
+     0 k: MPG shuttle mode terminated
+     0 k: CS0 state: shuttle_terminate (end)
+     0 k:   t=0.000268 TimeExecuted=32.495906 TimeDownloaded=33.996697 TimeLost=0.000000
+     0 k:   TimeBase=0.000000us TimeBaseDelta=0.041021us DecelTime=0.000001 TimeBaseDesired=0.000000us
+     0 k:   DoingRapid=0 Flushed=0 HoldAtEnd=0 NomDecel2TB2=12188868.000000
+     0 k:   StoppingState=1 LastFRO=0.250000 LastRapidFRO=1.000000

Rotating the shuttle control will call SetFROwRateTemp() in the control loop.  It seems that having a call to that function will change the StoppingState from 1 to 3.  That's the only obvious difference I can see, along with TimeBase being set to exactly 0.

Finally, regarding point (1) in the original message of this thread: whatever I do, I seem to get an instant stop.  I replaced the
    SetFROTemp(0.);
with
    SetFROwRateTemp(0., 0.3);

but it still screeches to a halt.  In the first console log snippet above, you can see that the time base starts at 22.5 and ends at 21.105.  The delta is 0.041.  Thus, it appears that exactly 34 increments have been applied.  That's a bit surprising to me, but I guess the printfs could have caused a long delay.

Regards,
SJH


On Wed, Dec 14, 2016 at 3:55 PM, Tom Kerekes tk@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
 

Hi SJH,

Sorry I missed that. 

I don't see anything obviously wrong.  Please print out the FRO values that you are setting on termination as well as all the CS0_xxxx variables so we can understand what went wrong.  Also the CS0_xxx variables when the system is in the 1/100th speed mode?

I also am having a hard time understanding your overall sequence of events.

Regards

TK



On 12/14/2016 2:56 PM, Hardy Family hardy.woodland.cypress@gmail. com [DynoMotion] wrote:
 
So any insight regarding this issue?  I added some info in message 3 of this thread, but not sure whether it got through.

Regards,
SJH




Group: DynoMotion Message: 14286 From: Hardy Family Date: 12/17/2016
Subject: Re: Some problems getting jog shuttle working.
PS: when exiting shuttle mode, I set the FROs to CS0_LastFRO which is 0.25 in this case.


On Sat, Dec 17, 2016 at 12:49 PM, Hardy Family <hardy.woodland.cypress@...> wrote:
I added a function which prints out all the CS0_ state.

Sequence of events: there is a main loop running in thread 7 which is responsible for handling the MPG controls.  When the user application enters/exits jog shuttle mode, it runs a small program in thread 1 to set some bits in shared memory that the main loop can access.  When the "enable shuttle" bit is first set, then it runs shuttle_init().  When the bit is cleared, it runs shuttle_terminate().  When enabled, it calls the control loop shuttle_fb_loop() every tick.  When the user rotates the shuttle wheel, it calls jog_shuttle() with each increment.

Here is the console log when I am running some g-code, start jog shuttle mode, press feed-hold, shuttle the program slightly, then exit shuttle mode.  Result is that program creeps forward very slowly (actually, I think it's backwards because the time base is left negative). 

I print the CS0 states at the start and end of the shuttle_init() and shuttle_terminate() functions.

I have my FRO set to 25% which is why the time base starts at 22.5us.  No qualitative difference is observed with normal 100% rate etc.

Turning on shuttle mode while program running (axes in motion):

+     0 k: CS0 state: shuttle_init (start)
+     0 k:   t=0.390783 TimeExecuted=31.024153 TimeDownloaded=33.642973 TimeLost=0.000000
+     0 k:   TimeBase=22.500000us TimeBaseDelta=0.041021us DecelTime=0.000001 TimeBaseDesired=22.500000us
+     0 k:   DoingRapid=0 Flushed=0 HoldAtEnd=0 NomDecel2TB2=12188868.000000
+     0 k:   StoppingState=0 LastFRO=0.250000 LastRapidFRO=1.000000
+     0 k: MPG shuttle mode started exec=      31.024 t=       0.392 lost=       0.000
+     0 k: CS0 state: shuttle_init (end)
+     0 k:   t=0.392440 TimeExecuted=31.024153 TimeDownloaded=33.642973 TimeLost=0.000000
+     0 k:   TimeBase=21.105285us TimeBaseDelta=0.041021us DecelTime=0.000001 TimeBaseDesired=0.000000us
+     0 k:   DoingRapid=0 Flushed=0 HoldAtEnd=0 NomDecel2TB2=12188868.000000
+     0 k:   StoppingState=0 LastFRO=0.250000 LastRapidFRO=1.000000
+     0 k: MPG jog enabled for 0x20 map_rotary=0 shuttle=1

this message when turning the shuttle wheel:

+   411 k: MPG shuttle mode unlocked exec=      31.024 t=       0.394 lost=       0.000

turning off shuttle mode:

+    87 k: CS0 state: shuttle_terminate (start)
+     0 k:   t=0.403802 TimeExecuted=31.024153 TimeDownloaded=33.642973 TimeLost=0.000000
+     0 k:   TimeBase=-0.132272us TimeBaseDelta=36.742346us DecelTime=0.000001 TimeBaseDesired=-0.132272us
+     0 k:   DoingRapid=0 Flushed=0 HoldAtEnd=0 NomDecel2TB2=12188868.000000
+     0 k:   StoppingState=3 LastFRO=0.250000 LastRapidFRO=1.000000
+     0 k: MPG shuttle mode terminated
+     0 k: CS0 state: shuttle_terminate (end)
+     0 k:   t=0.403794 TimeExecuted=31.024153 TimeDownloaded=33.642973 TimeLost=0.000000
+     0 k:   TimeBase=-0.132272us TimeBaseDelta=0.041021us DecelTime=0.000001 TimeBaseDesired=-0.132272us
+     0 k:   DoingRapid=0 Flushed=0 HoldAtEnd=0 NomDecel2TB2=12188868.000000
+     0 k:   StoppingState=3 LastFRO=0.250000 LastRapidFRO=1.000000

Note that CS0_TimeBase[Desired] seems to be left at a small negative value, whether I shuttle forward or back.  Maybe I should look at StoppingState and force TimeBase to 0 based on that?

If I do all of the above except that I do not actually rotate the shuttle control, then it remembers the feed hold exactly and does not creep forward.  Also, CS0_StoppingState will be at 1 instead of 3.

Here is the log (at shuttle termination) for that case:

+     0 k: CS0 state: shuttle_terminate (start)
+     1 k:   t=0.000268 TimeExecuted=32.495906 TimeDownloaded=33.996697 TimeLost=0.000000
+     0 k:   TimeBase=0.000000us TimeBaseDelta=8100.000020us DecelTime=0.000001 TimeBaseDesired=0.000000us
+     0 k:   DoingRapid=0 Flushed=0 HoldAtEnd=0 NomDecel2TB2=12188868.000000
+     0 k:   StoppingState=1 LastFRO=0.250000 LastRapidFRO=1.000000
+     0 k: MPG shuttle mode terminated
+     0 k: CS0 state: shuttle_terminate (end)
+     0 k:   t=0.000268 TimeExecuted=32.495906 TimeDownloaded=33.996697 TimeLost=0.000000
+     0 k:   TimeBase=0.000000us TimeBaseDelta=0.041021us DecelTime=0.000001 TimeBaseDesired=0.000000us
+     0 k:   DoingRapid=0 Flushed=0 HoldAtEnd=0 NomDecel2TB2=12188868.000000
+     0 k:   StoppingState=1 LastFRO=0.250000 LastRapidFRO=1.000000

Rotating the shuttle control will call SetFROwRateTemp() in the control loop.  It seems that having a call to that function will change the StoppingState from 1 to 3.  That's the only obvious difference I can see, along with TimeBase being set to exactly 0.

Finally, regarding point (1) in the original message of this thread: whatever I do, I seem to get an instant stop.  I replaced the
    SetFROTemp(0.);
with
    SetFROwRateTemp(0., 0.3);

but it still screeches to a halt.  In the first console log snippet above, you can see that the time base starts at 22.5 and ends at 21.105.  The delta is 0.041.  Thus, it appears that exactly 34 increments have been applied.  That's a bit surprising to me, but I guess the printfs could have caused a long delay.

Regards,
SJH


On Wed, Dec 14, 2016 at 3:55 PM, Tom Kerekes tk@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
 

Hi SJH,

Sorry I missed that. 

I don't see anything obviously wrong.  Please print out the FRO values that you are setting on termination as well as all the CS0_xxxx variables so we can understand what went wrong.  Also the CS0_xxx variables when the system is in the 1/100th speed mode?

I also am having a hard time understanding your overall sequence of events.

Regards

TK



On 12/14/2016 2:56 PM, Hardy Family hardy.woodland.cypress@gmail.c om [DynoMotion] wrote:
 
So any insight regarding this issue?  I added some info in message 3 of this thread, but not sure whether it got through.

Regards,
SJH





Group: DynoMotion Message: 14290 From: Tom Kerekes Date: 12/18/2016
Subject: Re: Some problems getting jog shuttle working.

Hi SJH,

I think the crux of the issue is that KFLOP basically ignores SetFRO() calls while in a FeedHold Condition.  It just saves the new FRO setting in CS0_LastFRO to be set later when FeedHold is released.  So for example in your shuttle terminate call of:

    SetFRO(CS0_LastFRO);

it does nothing while in Feed Hold.

The "Temporary" FRO calls do affect the desired Time Base while in feedhold.  I suspect the shuttle_fb_loop() called SetFROwRateTemp() with a small negative value at some point before your shuttle termination.  Your feedback code may have a small dither around setpoint issue.

It isn't clear to me why you would allow the User to select Feedhold while in shuttle mode.  Or why you would want shuttle motion while the user is requesting Feedhold.

But in your current scheme of things one solution might be to call SetFROwRateTemp() with a zero value in your shuttle termination. Followed by the call to SetFRO(CS0_LastFRO);  In that case if currently in FeedHold, the motion should remain stopped (and resume to CS0_LastFRO when FeedHold is released).  Or if not in FeedHold, it will immediately continue at CS0_LastFRO;

On a side topic I see DecelTime=0.000001.  1us is the minimum allowed Deceleration time basically to avoid divides by zero.  The Deceleration times are computed based on the Axes Velocities, Accelerations, and Jerks of all the axes defined in the Coordinate System.  Could you be attempting to set the FRO when no axes are defined to be in the Coordinate System?  Or all the Velocities are Zero?

It isn't clear why SetFROwRateTemp(0., 0.3); gives an abrupt stop.  The simple code KFLOP uses is shown below.  Please try again an print the two variables to see if they are being set properly.

// change from current to the specified FRO (FRO=1.0=Realtime)
// using a rate based on caller specified time to change from 1.0 to 0.0

void SetFROwRateTemp(float FRO, float DecelTime)
{
    if (DecelTime < 1e-6)DecelTime=1e-6;
    CS0_TimeBaseDelta = TIMEBASE*TIMEBASE/DecelTime;
    CS0_TimeBaseDesired = FRO * TIMEBASE;
}

HTH

Regards

TK


On 12/17/2016 12:51 PM, Hardy Family hardy.woodland.cypress@... [DynoMotion] wrote:
 
PS: when exiting shuttle mode, I set the FROs to CS0_LastFRO which is 0.25 in this case.


On Sat, Dec 17, 2016 at 12:49 PM, Hardy Family <hardy.woodland.cypress@...> wrote:
I added a function which prints out all the CS0_ state.

Sequence of events: there is a main loop running in thread 7 which is responsible for handling the MPG controls.  When the user application enters/exits jog shuttle mode, it runs a small program in thread 1 to set some bits in shared memory that the main loop can access.  When the "enable shuttle" bit is first set, then it runs shuttle_init().  When the bit is cleared, it runs shuttle_terminate().  When enabled, it calls the control loop shuttle_fb_loop() every tick.  When the user rotates the shuttle wheel, it calls jog_shuttle() with each increment.

Here is the console log when I am running some g-code, start jog shuttle mode, press feed-hold, shuttle the program slightly, then exit shuttle mode.  Result is that program creeps forward very slowly (actually, I think it's backwards because the time base is left negative). 

I print the CS0 states at the start and end of the shuttle_init() and shuttle_terminate() functions.

I have my FRO set to 25% which is why the time base starts at 22.5us.  No qualitative difference is observed with normal 100% rate etc.

Turning on shuttle mode while program running (axes in motion):

+     0 k: CS0 state: shuttle_init (start)
+     0 k:   t=0.390783 TimeExecuted=31.024153 TimeDownloaded=33.642973 TimeLost=0.000000
+     0 k:   TimeBase=22.500000us TimeBaseDelta=0.041021us DecelTime=0.000001 TimeBaseDesired=22.500000us
+     0 k:   DoingRapid=0 Flushed=0 HoldAtEnd=0 NomDecel2TB2=12188868.000000
+     0 k:   StoppingState=0 LastFRO=0.250000 LastRapidFRO=1.000000
+     0 k: MPG shuttle mode started exec=      31.024 t=       0.392 lost=       0.000
+     0 k: CS0 state: shuttle_init (end)
+     0 k:   t=0.392440 TimeExecuted=31.024153 TimeDownloaded=33.642973 TimeLost=0.000000
+     0 k:   TimeBase=21.105285us TimeBaseDelta=0.041021us DecelTime=0.000001 TimeBaseDesired=0.000000us
+     0 k:   DoingRapid=0 Flushed=0 HoldAtEnd=0 NomDecel2TB2=12188868.000000
+     0 k:   StoppingState=0 LastFRO=0.250000 LastRapidFRO=1.000000
+     0 k: MPG jog enabled for 0x20 map_rotary=0 shuttle=1

this message when turning the shuttle wheel:

+   411 k: MPG shuttle mode unlocked exec=      31.024 t=       0.394 lost=       0.000

turning off shuttle mode:

+    87 k: CS0 state: shuttle_terminate (start)
+     0 k:   t=0.403802 TimeExecuted=31.024153 TimeDownloaded=33.642973 TimeLost=0.000000
+     0 k:   TimeBase=-0.132272us TimeBaseDelta=36.742346us DecelTime=0.000001 TimeBaseDesired=-0.132272us
+     0 k:   DoingRapid=0 Flushed=0 HoldAtEnd=0 NomDecel2TB2=12188868.000000
+     0 k:   StoppingState=3 LastFRO=0.250000 LastRapidFRO=1.000000
+     0 k: MPG shuttle mode terminated
+     0 k: CS0 state: shuttle_terminate (end)
+     0 k:   t=0.403794 TimeExecuted=31.024153 TimeDownloaded=33.642973 TimeLost=0.000000
+     0 k:   TimeBase=-0.132272us TimeBaseDelta=0.041021us DecelTime=0.000001 TimeBaseDesired=-0.132272us
+     0 k:   DoingRapid=0 Flushed=0 HoldAtEnd=0 NomDecel2TB2=12188868.000000
+     0 k:   StoppingState=3 LastFRO=0.250000 LastRapidFRO=1.000000

Note that CS0_TimeBase[Desired] seems to be left at a small negative value, whether I shuttle forward or back.  Maybe I should look at StoppingState and force TimeBase to 0 based on that?

If I do all of the above except that I do not actually rotate the shuttle control, then it remembers the feed hold exactly and does not creep forward.  Also, CS0_StoppingState will be at 1 instead of 3.

Here is the log (at shuttle termination) for that case:

+     0 k: CS0 state: shuttle_terminate (start)
+     1 k:   t=0.000268 TimeExecuted=32.495906 TimeDownloaded=33.996697 TimeLost=0.000000
+     0 k:   TimeBase=0.000000us TimeBaseDelta=8100.000020us DecelTime=0.000001 TimeBaseDesired=0.000000us
+     0 k:   DoingRapid=0 Flushed=0 HoldAtEnd=0 NomDecel2TB2=12188868.000000
+     0 k:   StoppingState=1 LastFRO=0.250000 LastRapidFRO=1.000000
+     0 k: MPG shuttle mode terminated
+     0 k: CS0 state: shuttle_terminate (end)
+     0 k:   t=0.000268 TimeExecuted=32.495906 TimeDownloaded=33.996697 TimeLost=0.000000
+     0 k:   TimeBase=0.000000us TimeBaseDelta=0.041021us DecelTime=0.000001 TimeBaseDesired=0.000000us
+     0 k:   DoingRapid=0 Flushed=0 HoldAtEnd=0 NomDecel2TB2=12188868.000000
+     0 k:   StoppingState=1 LastFRO=0.250000 LastRapidFRO=1.000000

Rotating the shuttle control will call SetFROwRateTemp() in the control loop.  It seems that having a call to that function will change the StoppingState from 1 to 3.  That's the only obvious difference I can see, along with TimeBase being set to exactly 0.

Finally, regarding point (1) in the original message of this thread: whatever I do, I seem to get an instant stop.  I replaced the
    SetFROTemp(0.);
with
    SetFROwRateTemp(0., 0.3);

but it still screeches to a halt.  In the first console log snippet above, you can see that the time base starts at 22.5 and ends at 21.105.  The delta is 0.041.  Thus, it appears that exactly 34 increments have been applied.  That's a bit surprising to me, but I guess the printfs could have caused a long delay.

Regards,
SJH


On Wed, Dec 14, 2016 at 3:55 PM, Tom Kerekes tk@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
 

Hi SJH,

Sorry I missed that. 

I don't see anything obviously wrong.  Please print out the FRO values that you are setting on termination as well as all the CS0_xxxx variables so we can understand what went wrong.  Also the CS0_xxx variables when the system is in the 1/100th speed mode?

I also am having a hard time understanding your overall sequence of events.

Regards

TK



On 12/14/2016 2:56 PM, Hardy Family hardy.woodland.cypress@gmail.c om [DynoMotion] wrote:
 
So any insight regarding this issue?  I added some info in message 3 of this thread, but not sure whether it got through.

Regards,
SJH






Group: DynoMotion Message: 14294 From: Hardy Family Date: 12/19/2016
Subject: Re: Some problems getting jog shuttle working.
Yes, that helped, thanks.

The problem with rapid stop was because my feedback loop got started immediately after shuttle_init(), and if you look at the code it is now obvious that it would have been using a zero decel time in the first call to SetFROwRateTemp().  That was pretty dumb.  (I think I might have been experimenting when first getting it to work and left in the bad call - I just replaced it with SetFROTemp() and let it compute the decel time.)

The creeping motion was solved by explicitly setting FRO to 0 on disable, as you suggested.  I think you are right in that there was some dither, and now that I am aware of it I can actually hear it on the machine.  It's probably because I use the sqrt function when calculating the desired FRO, but that gives a larger gain near the setpoint.  Combined with the 90us discretization, it causes dither.  Maybe I can add some deadband.  Without the sqrt it seemed a bit sluggish to respond, but I think now that I should experiment with the other parameters and probably get a better result.

Regarding the combination of feed hold and shuttle, well that was my backup plan, to disable FH when in shuttle mode.  However, I was fond of the ability to control FH independently, since it was useful to be able to stop the machine using either function, but not unexpectedly restart feed when terminating shuttle mode.  Our application has separate status indicator for both states, and as a general rule I like all control functions to be as orthogonal as possible.

Regards,
SJH


On Sun, Dec 18, 2016 at 5:46 PM, Tom Kerekes tk@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
 

Hi SJH,

I think the crux of the issue is that KFLOP basically ignores SetFRO() calls while in a FeedHold Condition.  It just saves the new FRO setting in CS0_LastFRO to be set later when FeedHold is released.  So for example in your shuttle terminate call of:

    SetFRO(CS0_LastFRO);

it does nothing while in Feed Hold.

The "Temporary" FRO calls do affect the desired Time Base while in feedhold.  I suspect the shuttle_fb_loop() called SetFROwRateTemp() with a small negative value at some point before your shuttle termination.  Your feedback code may have a small dither around setpoint issue.

It isn't clear to me why you would allow the User to select Feedhold while in shuttle mode.  Or why you would want shuttle motion while the user is requesting Feedhold.

But in your current scheme of things one solution might be to call SetFROwRateTemp() with a zero value in your shuttle termination. Followed by the call to SetFRO(CS0_LastFRO);  In that case if currently in FeedHold, the motion should remain stopped (and resume to CS0_LastFRO when FeedHold is released).  Or if not in FeedHold, it will immediately continue at CS0_LastFRO;

On a side topic I see DecelTime=0.000001.  1us is the minimum allowed Deceleration time basically to avoid divides by zero.  The Deceleration times are computed based on the Axes Velocities, Accelerations, and Jerks of all the axes defined in the Coordinate System.  Could you be attempting to set the FRO when no axes are defined to be in the Coordinate System?  Or all the Velocities are Zero?

It isn't clear why SetFROwRateTemp(0., 0.3); gives an abrupt stop.  The simple code KFLOP uses is shown below.  Please try again an print the two variables to see if they are being set properly.

// change from current to the specified FRO (FRO=1.0=Realtime)
// using a rate based on caller specified time to change from 1.0 to 0.0

void SetFROwRateTemp(float FRO, float DecelTime)
{
    if (DecelTime < 1e-6)DecelTime=1e-6;
    CS0_TimeBaseDelta = TIMEBASE*TIMEBASE/DecelTime;
    CS0_TimeBaseDesired = FRO * TIMEBASE;
}

HTH

Regards

TK


On 12/17/2016 12:51 PM, Hardy Family hardy.woodland.cypress@gmail. com [DynoMotion] wrote:
 
PS: when exiting shuttle mode, I set the FROs to CS0_LastFRO which is 0.25 in this case.


On Sat, Dec 17, 2016 at 12:49 PM, Hardy Family <hardy.woodland.cypress@gmail. com> wrote:
I added a function which prints out all the CS0_ state.

Sequence of events: there is a main loop running in thread 7 which is responsible for handling the MPG controls.  When the user application enters/exits jog shuttle mode, it runs a small program in thread 1 to set some bits in shared memory that the main loop can access.  When the "enable shuttle" bit is first set, then it runs shuttle_init().  When the bit is cleared, it runs shuttle_terminate().  When enabled, it calls the control loop shuttle_fb_loop() every tick.  When the user rotates the shuttle wheel, it calls jog_shuttle() with each increment.

Here is the console log when I am running some g-code, start jog shuttle mode, press feed-hold, shuttle the program slightly, then exit shuttle mode.  Result is that program creeps forward very slowly (actually, I think it's backwards because the time base is left negative). 

I print the CS0 states at the start and end of the shuttle_init() and shuttle_terminate() functions.

I have my FRO set to 25% which is why the time base starts at 22.5us.  No qualitative difference is observed with normal 100% rate etc.

Turning on shuttle mode while program running (axes in motion):

+     0 k: CS0 state: shuttle_init (start)
+     0 k:   t=0.390783 TimeExecuted=31.024153 TimeDownloaded=33.642973 TimeLost=0.000000
+     0 k:   TimeBase=22.500000us TimeBaseDelta=0.041021us DecelTime=0.000001 TimeBaseDesired=22.500000us
+     0 k:   DoingRapid=0 Flushed=0 HoldAtEnd=0 NomDecel2TB2=12188868.000000
+     0 k:   StoppingState=0 LastFRO=0.250000 LastRapidFRO=1.000000
+     0 k: MPG shuttle mode started exec=      31.024 t=       0.392 lost=       0.000
+     0 k: CS0 state: shuttle_init (end)
+     0 k:   t=0.392440 TimeExecuted=31.024153 TimeDownloaded=33.642973 TimeLost=0.000000
+     0 k:   TimeBase=21.105285us TimeBaseDelta=0.041021us DecelTime=0.000001 TimeBaseDesired=0.000000us
+     0 k:   DoingRapid=0 Flushed=0 HoldAtEnd=0 NomDecel2TB2=12188868.000000
+     0 k:   StoppingState=0 LastFRO=0.250000 LastRapidFRO=1.000000
+     0 k: MPG jog enabled for 0x20 map_rotary=0 shuttle=1

this message when turning the shuttle wheel:

+   411 k: MPG shuttle mode unlocked exec=      31.024 t=       0.394 lost=       0.000

turning off shuttle mode:

+    87 k: CS0 state: shuttle_terminate (start)
+     0 k:   t=0.403802 TimeExecuted=31.024153 TimeDownloaded=33.642973 TimeLost=0.000000
+     0 k:   TimeBase=-0.132272us TimeBaseDelta=36.742346us DecelTime=0.000001 TimeBaseDesired=-0.132272us
+     0 k:   DoingRapid=0 Flushed=0 HoldAtEnd=0 NomDecel2TB2=12188868.000000
+     0 k:   StoppingState=3 LastFRO=0.250000 LastRapidFRO=1.000000
+     0 k: MPG shuttle mode terminated
+     0 k: CS0 state: shuttle_terminate (end)
+     0 k:   t=0.403794 TimeExecuted=31.024153 TimeDownloaded=33.642973 TimeLost=0.000000
+     0 k:   TimeBase=-0.132272us TimeBaseDelta=0.041021us DecelTime=0.000001 TimeBaseDesired=-0.132272us
+     0 k:   DoingRapid=0 Flushed=0 HoldAtEnd=0 NomDecel2TB2=12188868.000000
+     0 k:   StoppingState=3 LastFRO=0.250000 LastRapidFRO=1.000000

Note that CS0_TimeBase[Desired] seems to be left at a small negative value, whether I shuttle forward or back.  Maybe I should look at StoppingState and force TimeBase to 0 based on that?

If I do all of the above except that I do not actually rotate the shuttle control, then it remembers the feed hold exactly and does not creep forward.  Also, CS0_StoppingState will be at 1 instead of 3.

Here is the log (at shuttle termination) for that case:

+     0 k: CS0 state: shuttle_terminate (start)
+     1 k:   t=0.000268 TimeExecuted=32.495906 TimeDownloaded=33.996697 TimeLost=0.000000
+     0 k:   TimeBase=0.000000us TimeBaseDelta=8100.000020us DecelTime=0.000001 TimeBaseDesired=0.000000us
+     0 k:   DoingRapid=0 Flushed=0 HoldAtEnd=0 NomDecel2TB2=12188868.000000
+     0 k:   StoppingState=1 LastFRO=0.250000 LastRapidFRO=1.000000
+     0 k: MPG shuttle mode terminated
+     0 k: CS0 state: shuttle_terminate (end)
+     0 k:   t=0.000268 TimeExecuted=32.495906 TimeDownloaded=33.996697 TimeLost=0.000000
+     0 k:   TimeBase=0.000000us TimeBaseDelta=0.041021us DecelTime=0.000001 TimeBaseDesired=0.000000us
+     0 k:   DoingRapid=0 Flushed=0 HoldAtEnd=0 NomDecel2TB2=12188868.000000
+     0 k:   StoppingState=1 LastFRO=0.250000 LastRapidFRO=1.000000

Rotating the shuttle control will call SetFROwRateTemp() in the control loop.  It seems that having a call to that function will change the StoppingState from 1 to 3.  That's the only obvious difference I can see, along with TimeBase being set to exactly 0.

Finally, regarding point (1) in the original message of this thread: whatever I do, I seem to get an instant stop.  I replaced the
    SetFROTemp(0.);
with
    SetFROwRateTemp(0., 0.3);

but it still screeches to a halt.  In the first console log snippet above, you can see that the time base starts at 22.5 and ends at 21.105.  The delta is 0.041.  Thus, it appears that exactly 34 increments have been applied.  That's a bit surprising to me, but I guess the printfs could have caused a long delay.

Regards,
SJH


On Wed, Dec 14, 2016 at 3:55 PM, Tom Kerekes tk@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
 

Hi SJH,

Sorry I missed that. 

I don't see anything obviously wrong.  Please print out the FRO values that you are setting on termination as well as all the CS0_xxxx variables so we can understand what went wrong.  Also the CS0_xxx variables when the system is in the 1/100th speed mode?

I also am having a hard time understanding your overall sequence of events.

Regards

TK



On 12/14/2016 2:56 PM, Hardy Family hardy.woodland.cypress@gmail.c om [DynoMotion] wrote:
 
So any insight regarding this issue?  I added some info in message 3 of this thread, but not sure whether it got through.

Regards,
SJH







Group: DynoMotion Message: 15116 From: Hardy Family Date: 10/30/2017
Subject: Re: Some problems getting jog shuttle working.
Hi Tom,

We're still having a few problems with jog shuttle.  It's probably my misunderstanding something, but it looks like the CS0_ variables are not getting initialized the way I would expect.  This is a function I use to print out the values:

void print_cs0(const char * heading)
{
    WaitNextTimeSlice();
    printf("CS0 state: %s\n", heading);
    printf("  t=%f TimeExecuted=%f TimeDownloaded=%f TimeLost=%f ToGo=%fus\n", CS0_t, CS0_TimeExecuted, CS0_TimeDownloaded, CS0_TimeLost,
            1E6*(CS0_TimeDownloaded - (CS0_t + CS0_TimeExecuted)));
    printf("  TimeBase=%fus TimeBaseDelta=%fus DecelTime=%fus TimeBaseDesired=%fus\n",
                 CS0_TimeBase*1E6, CS0_TimeBaseDelta*1E6, CS0_DecelTime*1E6, CS0_TimeBaseDesired*1E6);
    printf("  DoingRapid=%d Flushed=%d HoldAtEnd=%d NomDecel2TB2=%f\n", (int)CS0_DoingRapid, (int)CS0_Flushed, (int)CS0_HoldAtEnd, CS0_NomDecel2TB2);
    printf("  StoppingState=%d LastFRO=%f LastRapidFRO=%f\n", CS0_StoppingState, CS0_LastFRO, CS0_LastRapidFRO);
}

After rebooting the kflop, connecting, homing the machine (uncoordinated motion), and initializing jog shuttle mode (but never running any coordinated motion) it prints the following:

+    99 k: CS0 state: shuttle_init (start)
+     0 k:   t=3.367286 TimeExecuted=0.126250 TimeDownloaded=5.718412 TimeLost=0.000000 ToGo=2224876.349456us
+     0 k:   TimeBase=90.000001us TimeBaseDelta=0.041021us DecelTime=1000000.000000us TimeBaseDesired=90.000000us
+     0 k:   DoingRapid=1 Flushed=0 HoldAtEnd=0 NomDecel2TB2=12188868.000000
+    95 k:   StoppingState=0 LastFRO=1.000000 LastRapidFRO=1.000000

What I don't understand is where the 2nd line info came from: why is there 5.7 sec of downloaded segments?  Why is t about 3.4 seconds into that?  Note that the machine is not moving at all, and yet I would think that if FROs are 1, then it would be moving.

Anyway, I hope you can provide some insight.  This is a very useful function, but we can't yet release it to customers because the machine moves unexpectedly in shuttle mode.  (If we get the above situation when entering jog shuttle mode, when the interpreter sends some real coordinated motion, it moves forward along the path when it really shouldn't).

We are running firmware 433q.

Regards,
SJH



On Mon, Dec 19, 2016 at 10:26 AM, Hardy Family <hardy.woodland.cypress@...> wrote:
Yes, that helped, thanks.

The problem with rapid stop was because my feedback loop got started immediately after shuttle_init(), and if you look at the code it is now obvious that it would have been using a zero decel time in the first call to SetFROwRateTemp().  That was pretty dumb.  (I think I might have been experimenting when first getting it to work and left in the bad call - I just replaced it with SetFROTemp() and let it compute the decel time.)

The creeping motion was solved by explicitly setting FRO to 0 on disable, as you suggested.  I think you are right in that there was some dither, and now that I am aware of it I can actually hear it on the machine.  It's probably because I use the sqrt function when calculating the desired FRO, but that gives a larger gain near the setpoint.  Combined with the 90us discretization, it causes dither.  Maybe I can add some deadband.  Without the sqrt it seemed a bit sluggish to respond, but I think now that I should experiment with the other parameters and probably get a better result.

Regarding the combination of feed hold and shuttle, well that was my backup plan, to disable FH when in shuttle mode.  However, I was fond of the ability to control FH independently, since it was useful to be able to stop the machine using either function, but not unexpectedly restart feed when terminating shuttle mode.  Our application has separate status indicator for both states, and as a general rule I like all control functions to be as orthogonal as possible.

Regards,
SJH


On Sun, Dec 18, 2016 at 5:46 PM, Tom Kerekes tk@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
 

Hi SJH,

I think the crux of the issue is that KFLOP basically ignores SetFRO() calls while in a FeedHold Condition.  It just saves the new FRO setting in CS0_LastFRO to be set later when FeedHold is released.  So for example in your shuttle terminate call of:

    SetFRO(CS0_LastFRO);

it does nothing while in Feed Hold.

The "Temporary" FRO calls do affect the desired Time Base while in feedhold.  I suspect the shuttle_fb_loop() called SetFROwRateTemp() with a small negative value at some point before your shuttle termination.  Your feedback code may have a small dither around setpoint issue.

It isn't clear to me why you would allow the User to select Feedhold while in shuttle mode.  Or why you would want shuttle motion while the user is requesting Feedhold.

But in your current scheme of things one solution might be to call SetFROwRateTemp() with a zero value in your shuttle termination. Followed by the call to SetFRO(CS0_LastFRO);  In that case if currently in FeedHold, the motion should remain stopped (and resume to CS0_LastFRO when FeedHold is released).  Or if not in FeedHold, it will immediately continue at CS0_LastFRO;

On a side topic I see DecelTime=0.000001.  1us is the minimum allowed Deceleration time basically to avoid divides by zero.  The Deceleration times are computed based on the Axes Velocities, Accelerations, and Jerks of all the axes defined in the Coordinate System.  Could you be attempting to set the FRO when no axes are defined to be in the Coordinate System?  Or all the Velocities are Zero?

It isn't clear why SetFROwRateTemp(0., 0.3); gives an abrupt stop.  The simple code KFLOP uses is shown below.  Please try again an print the two variables to see if they are being set properly.

// change from current to the specified FRO (FRO=1.0=Realtime)
// using a rate based on caller specified time to change from 1.0 to 0.0

void SetFROwRateTemp(float FRO, float DecelTime)
{
    if (DecelTime < 1e-6)DecelTime=1e-6;
    CS0_TimeBaseDelta = TIMEBASE*TIMEBASE/DecelTime;
    CS0_TimeBaseDesired = FRO * TIMEBASE;
}

HTH

Regards

TK


On 12/17/2016 12:51 PM, Hardy Family hardy.woodland.cypress@gmail.c om [DynoMotion] wrote:
 
PS: when exiting shuttle mode, I set the FROs to CS0_LastFRO which is 0.25 in this case.


On Sat, Dec 17, 2016 at 12:49 PM, Hardy Family <hardy.woodland.cypress@gmail. com> wrote:
I added a function which prints out all the CS0_ state.

Sequence of events: there is a main loop running in thread 7 which is responsible for handling the MPG controls.  When the user application enters/exits jog shuttle mode, it runs a small program in thread 1 to set some bits in shared memory that the main loop can access.  When the "enable shuttle" bit is first set, then it runs shuttle_init().  When the bit is cleared, it runs shuttle_terminate().  When enabled, it calls the control loop shuttle_fb_loop() every tick.  When the user rotates the shuttle wheel, it calls jog_shuttle() with each increment.

Here is the console log when I am running some g-code, start jog shuttle mode, press feed-hold, shuttle the program slightly, then exit shuttle mode.  Result is that program creeps forward very slowly (actually, I think it's backwards because the time base is left negative). 

I print the CS0 states at the start and end of the shuttle_init() and shuttle_terminate() functions.

I have my FRO set to 25% which is why the time base starts at 22.5us.  No qualitative difference is observed with normal 100% rate etc.

Turning on shuttle mode while program running (axes in motion):

+     0 k: CS0 state: shuttle_init (start)
+     0 k:   t=0.390783 TimeExecuted=31.024153 TimeDownloaded=33.642973 TimeLost=0.000000
+     0 k:   TimeBase=22.500000us TimeBaseDelta=0.041021us DecelTime=0.000001 TimeBaseDesired=22.500000us
+     0 k:   DoingRapid=0 Flushed=0 HoldAtEnd=0 NomDecel2TB2=12188868.000000
+     0 k:   StoppingState=0 LastFRO=0.250000 LastRapidFRO=1.000000
+     0 k: MPG shuttle mode started exec=      31.024 t=       0.392 lost=       0.000
+     0 k: CS0 state: shuttle_init (end)
+     0 k:   t=0.392440 TimeExecuted=31.024153 TimeDownloaded=33.642973 TimeLost=0.000000
+     0 k:   TimeBase=21.105285us TimeBaseDelta=0.041021us DecelTime=0.000001 TimeBaseDesired=0.000000us
+     0 k:   DoingRapid=0 Flushed=0 HoldAtEnd=0 NomDecel2TB2=12188868.000000
+     0 k:   StoppingState=0 LastFRO=0.250000 LastRapidFRO=1.000000
+     0 k: MPG jog enabled for 0x20 map_rotary=0 shuttle=1

this message when turning the shuttle wheel:

+   411 k: MPG shuttle mode unlocked exec=      31.024 t=       0.394 lost=       0.000

turning off shuttle mode:

+    87 k: CS0 state: shuttle_terminate (start)
+     0 k:   t=0.403802 TimeExecuted=31.024153 TimeDownloaded=33.642973 TimeLost=0.000000
+     0 k:   TimeBase=-0.132272us TimeBaseDelta=36.742346us DecelTime=0.000001 TimeBaseDesired=-0.132272us
+     0 k:   DoingRapid=0 Flushed=0 HoldAtEnd=0 NomDecel2TB2=12188868.000000
+     0 k:   StoppingState=3 LastFRO=0.250000 LastRapidFRO=1.000000
+     0 k: MPG shuttle mode terminated
+     0 k: CS0 state: shuttle_terminate (end)
+     0 k:   t=0.403794 TimeExecuted=31.024153 TimeDownloaded=33.642973 TimeLost=0.000000
+     0 k:   TimeBase=-0.132272us TimeBaseDelta=0.041021us DecelTime=0.000001 TimeBaseDesired=-0.132272us
+     0 k:   DoingRapid=0 Flushed=0 HoldAtEnd=0 NomDecel2TB2=12188868.000000
+     0 k:   StoppingState=3 LastFRO=0.250000 LastRapidFRO=1.000000

Note that CS0_TimeBase[Desired] seems to be left at a small negative value, whether I shuttle forward or back.  Maybe I should look at StoppingState and force TimeBase to 0 based on that?

If I do all of the above except that I do not actually rotate the shuttle control, then it remembers the feed hold exactly and does not creep forward.  Also, CS0_StoppingState will be at 1 instead of 3.

Here is the log (at shuttle termination) for that case:

+     0 k: CS0 state: shuttle_terminate (start)
+     1 k:   t=0.000268 TimeExecuted=32.495906 TimeDownloaded=33.996697 TimeLost=0.000000
+     0 k:   TimeBase=0.000000us TimeBaseDelta=8100.000020us DecelTime=0.000001 TimeBaseDesired=0.000000us
+     0 k:   DoingRapid=0 Flushed=0 HoldAtEnd=0 NomDecel2TB2=12188868.000000
+     0 k:   StoppingState=1 LastFRO=0.250000 LastRapidFRO=1.000000
+     0 k: MPG shuttle mode terminated
+     0 k: CS0 state: shuttle_terminate (end)
+     0 k:   t=0.000268 TimeExecuted=32.495906 TimeDownloaded=33.996697 TimeLost=0.000000
+     0 k:   TimeBase=0.000000us TimeBaseDelta=0.041021us DecelTime=0.000001 TimeBaseDesired=0.000000us
+     0 k:   DoingRapid=0 Flushed=0 HoldAtEnd=0 NomDecel2TB2=12188868.000000
+     0 k:   StoppingState=1 LastFRO=0.250000 LastRapidFRO=1.000000

Rotating the shuttle control will call SetFROwRateTemp() in the control loop.  It seems that having a call to that function will change the StoppingState from 1 to 3.  That's the only obvious difference I can see, along with TimeBase being set to exactly 0.

Finally, regarding point (1) in the original message of this thread: whatever I do, I seem to get an instant stop.  I replaced the
    SetFROTemp(0.);
with
    SetFROwRateTemp(0., 0.3);

but it still screeches to a halt.  In the first console log snippet above, you can see that the time base starts at 22.5 and ends at 21.105.  The delta is 0.041.  Thus, it appears that exactly 34 increments have been applied.  That's a bit surprising to me, but I guess the printfs could have caused a long delay.

Regards,
SJH


On Wed, Dec 14, 2016 at 3:55 PM, Tom Kerekes tk@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
 

Hi SJH,

Sorry I missed that. 

I don't see anything obviously wrong.  Please print out the FRO values that you are setting on termination as well as all the CS0_xxxx variables so we can understand what went wrong.  Also the CS0_xxx variables when the system is in the 1/100th speed mode?

I also am having a hard time understanding your overall sequence of events.

Regards

TK



On 12/14/2016 2:56 PM, Hardy Family hardy.woodland.cypress@gmail.c om [DynoMotion] wrote:
 
So any insight regarding this issue?  I added some info in message 3 of this thread, but not sure whether it got through.

Regards,
SJH








Group: DynoMotion Message: 15119 From: TKSOFT Date: 10/31/2017
Subject: Re: Some problems getting jog shuttle working.
Hi SJH,

That doesn't make sense to me either. Those should be initialized to
zero on power up boot - although they don't really need to be
initialized until the Coordinated Motion Buffer is opened and then
Executed.

CoordSystem0 is a pointer to the segments to execute. If that is NULL
then no Coordinated Motion will occur.

I'd suggest you print those immediately after power up and then at
various points to see what in your code is affecting them.

Regards
TK


On 2017-10-30 17:11, Hardy Family hardy.woodland.cypress@...
[DynoMotion] wrote:
> Hi Tom,
>
> We're still having a few problems with jog shuttle. It's probably my
> misunderstanding something, but it looks like the CS0_ variables are
> not getting initialized the way I would expect. This is a function I
> use to print out the values:
>
> void print_cs0(const char * heading)
> {
> WaitNextTimeSlice();
> printf("CS0 state: %s\n", heading);
> printf(" t=%f TimeExecuted=%f TimeDownloaded=%f TimeLost=%f
> ToGo=%fus\n", CS0_t, CS0_TimeExecuted, CS0_TimeDownloaded,
> CS0_TimeLost,
> 1E6*(CS0_TimeDownloaded - (CS0_t + CS0_TimeExecuted)));
> printf(" TimeBase=%fus TimeBaseDelta=%fus DecelTime=%fus
> TimeBaseDesired=%fus\n",
> CS0_TimeBase*1E6, CS0_TimeBaseDelta*1E6,
> CS0_DecelTime*1E6, CS0_TimeBaseDesired*1E6);
> printf(" DoingRapid=%d Flushed=%d HoldAtEnd=%d
> NomDecel2TB2=%f\n", (int)CS0_DoingRapid, (int)CS0_Flushed,
> (int)CS0_HoldAtEnd, CS0_NomDecel2TB2);
> printf(" StoppingState=%d LastFRO=%f LastRapidFRO=%f\n",
> CS0_StoppingState, CS0_LastFRO, CS0_LastRapidFRO);
> }
>
> After rebooting the kflop, connecting, homing the machine
> (uncoordinated motion), and initializing jog shuttle mode (but never
> running any coordinated motion) it prints the following:
>
> + 99 k: CS0 state: shuttle_init (start)
> + 0 k: t=3.367286 TimeExecuted=0.126250 TimeDownloaded=5.718412
> TimeLost=0.000000 ToGo=2224876.349456us
> + 0 k: TimeBase=90.000001us TimeBaseDelta=0.041021us
> DecelTime=1000000.000000us TimeBaseDesired=90.000000us
> + 0 k: DoingRapid=1 Flushed=0 HoldAtEnd=0
> NomDecel2TB2=12188868.000000
> + 95 k: StoppingState=0 LastFRO=1.000000 LastRapidFRO=1.000000
>
> What I don't understand is where the 2nd line info came from: why is
> there 5.7 sec of downloaded segments? Why is t about 3.4 seconds into
> that? Note that the machine is not moving at all, and yet I would
> think that if FROs are 1, then it would be moving.
>
> Anyway, I hope you can provide some insight. This is a very useful
> function, but we can't yet release it to customers because the machine
> moves unexpectedly in shuttle mode. (If we get the above situation
> when entering jog shuttle mode, when the interpreter sends some real
> coordinated motion, it moves forward along the path when it really
> shouldn't).
>
> We are running firmware 433q.
>
> Regards,
> SJH
>
> On Mon, Dec 19, 2016 at 10:26 AM, Hardy Family
> <hardy.woodland.cypress@...> wrote:
>
>> Yes, that helped, thanks.
>>
>> The problem with rapid stop was because my feedback loop got started
>> immediately after shuttle_init(), and if you look at the code it is
>> now obvious that it would have been using a zero decel time in the
>> first call to SetFROwRateTemp(). That was pretty dumb. (I think I
>> might have been experimenting when first getting it to work and left
>> in the bad call - I just replaced it with SetFROTemp() and let it
>> compute the decel time.)
>>
>> The creeping motion was solved by explicitly setting FRO to 0 on
>> disable, as you suggested. I think you are right in that there was
>> some dither, and now that I am aware of it I can actually hear it on
>> the machine. It's probably because I use the sqrt function when
>> calculating the desired FRO, but that gives a larger gain near the
>> setpoint. Combined with the 90us discretization, it causes dither.
>> Maybe I can add some deadband. Without the sqrt it seemed a bit
>> sluggish to respond, but I think now that I should experiment with
>> the other parameters and probably get a better result.
>>
>> Regarding the combination of feed hold and shuttle, well that was my
>> backup plan, to disable FH when in shuttle mode. However, I was
>> fond of the ability to control FH independently, since it was useful
>> to be able to stop the machine using either function, but not
>> unexpectedly restart feed when terminating shuttle mode. Our
>> application has separate status indicator for both states, and as a
>> general rule I like all control functions to be as orthogonal as
>> possible.
>>
>> Regards,
>> SJH
>>
>> On Sun, Dec 18, 2016 at 5:46 PM, Tom Kerekes tk@...
>> [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
>>
>> Hi SJH,
>>
>> I think the crux of the issue is that KFLOP basically ignores
>> SetFRO() calls while in a FeedHold Condition. It just saves the new
>> FRO setting in CS0_LastFRO to be set later when FeedHold is
>> released. So for example in your shuttle terminate call of:
>>
>> SetFRO(CS0_LastFRO);
>>
>> it does nothing while in Feed Hold.
>>
>> The "Temporary" FRO calls do affect the desired Time Base while in
>> feedhold. I suspect the shuttle_fb_loop() called SetFROwRateTemp()
>> with a small negative value at some point before your shuttle
>> termination. Your feedback code may have a small dither around
>> setpoint issue.
>>
>> It isn't clear to me why you would allow the User to select Feedhold
>> while in shuttle mode. Or why you would want shuttle motion while
>> the user is requesting Feedhold.
>>
>> But in your current scheme of things one solution might be to call
>> SetFROwRateTemp() with a zero value in your shuttle termination.
>> Followed by the call to SetFRO(CS0_LastFRO); In that case if
>> currently in FeedHold, the motion should remain stopped (and resume
>> to CS0_LastFRO when FeedHold is released). Or if not in FeedHold,
>> it will immediately continue at CS0_LastFRO;
>>
>> On a side topic I see DecelTime=0.000001. 1us is the minimum
>> allowed Deceleration time basically to avoid divides by zero. The
>> Deceleration times are computed based on the Axes Velocities,
>> Accelerations, and Jerks of all the axes defined in the Coordinate
>> System. Could you be attempting to set the FRO when no axes are
>> defined to be in the Coordinate System? Or all the Velocities are
>> Zero?
>>
>> It isn't clear why SetFROwRateTemp(0., 0.3); gives an abrupt stop.
>> The simple code KFLOP uses is shown below. Please try again an
>> print the two variables to see if they are being set properly.
>>
>> // change from current to the specified FRO (FRO=1.0=Realtime)
>> // using a rate based on caller specified time to change from 1.0 to
>> 0.0
>>
>> void SetFROwRateTemp(float FRO, float DecelTime)
>> {
>> if (DecelTime < 1e-6)DecelTime=1e-6;
>> CS0_TimeBaseDelta = TIMEBASE*TIMEBASE/DecelTime;
>> CS0_TimeBaseDesired = FRO * TIMEBASE;
>> }
>>
>> HTH
>>
>> Regards
>>
>> TK
>>
>> On 12/17/2016 12:51 PM, Hardy Family
>> hardy.woodland.cypress@... [DynoMotion] wrote:
>>
>> PS: when exiting shuttle mode, I set the FROs to CS0_LastFRO which
>> is 0.25 in this case.
>>
>> On Sat, Dec 17, 2016 at 12:49 PM, Hardy Family
>> <hardy.woodland.cypress@...> wrote:
>>
>> I added a function which prints out all the CS0_ state.
>>
>> Sequence of events: there is a main loop running in thread 7 which
>> is responsible for handling the MPG controls. When the user
>> application enters/exits jog shuttle mode, it runs a small program
>> in thread 1 to set some bits in shared memory that the main loop can
>> access. When the "enable shuttle" bit is first set, then it runs
>> shuttle_init(). When the bit is cleared, it runs
>> shuttle_terminate(). When enabled, it calls the control loop
>> shuttle_fb_loop() every tick. When the user rotates the shuttle
>> wheel, it calls jog_shuttle() with each increment.
>>
>> Here is the console log when I am running some g-code, start jog
>> shuttle mode, press feed-hold, shuttle the program slightly, then
>> exit shuttle mode. Result is that program creeps forward very
>> slowly (actually, I think it's backwards because the time base is
>> left negative).
>>
>> I print the CS0 states at the start and end of the shuttle_init()
>> and shuttle_terminate() functions.
>>
>> I have my FRO set to 25% which is why the time base starts at
>> 22.5us. No qualitative difference is observed with normal 100% rate
>> etc.
>>
>> Turning on shuttle mode while program running (axes in motion):
>>
>> + 0 k: CS0 state: shuttle_init (start)
>> + 0 k: t=0.390783 TimeExecuted=31.024153
>> TimeDownloaded=33.642973 TimeLost=0.000000
>> + 0 k: TimeBase=22.500000us TimeBaseDelta=0.041021us
>> DecelTime=0.000001 TimeBaseDesired=22.500000us
>> + 0 k: DoingRapid=0 Flushed=0 HoldAtEnd=0
>> NomDecel2TB2=12188868.000000
>> + 0 k: StoppingState=0 LastFRO=0.250000 LastRapidFRO=1.000000
>> + 0 k: MPG shuttle mode started exec= 31.024 t= 0.392
>> lost= 0.000
>> + 0 k: CS0 state: shuttle_init (end)
>> + 0 k: t=0.392440 TimeExecuted=31.024153
>> TimeDownloaded=33.642973 TimeLost=0.000000
>> + 0 k: TimeBase=21.105285us TimeBaseDelta=0.041021us
>> DecelTime=0.000001 TimeBaseDesired=0.000000us
>> + 0 k: DoingRapid=0 Flushed=0 HoldAtEnd=0
>> NomDecel2TB2=12188868.000000
>> + 0 k: StoppingState=0 LastFRO=0.250000 LastRapidFRO=1.000000
>> + 0 k: MPG jog enabled for 0x20 map_rotary=0 shuttle=1
>>
>> this message when turning the shuttle wheel:
>>
>> + 411 k: MPG shuttle mode unlocked exec= 31.024 t=
>> 0.394 lost= 0.000
>>
>> turning off shuttle mode:
>>
>> + 87 k: CS0 state: shuttle_terminate (start)
>> + 0 k: t=0.403802 TimeExecuted=31.024153
>> TimeDownloaded=33.642973 TimeLost=0.000000
>> + 0 k: TimeBase=-0.132272us TimeBaseDelta=36.742346us
>> DecelTime=0.000001 TimeBaseDesired=-0.132272us
>> + 0 k: DoingRapid=0 Flushed=0 HoldAtEnd=0
>> NomDecel2TB2=12188868.000000
>> + 0 k: StoppingState=3 LastFRO=0.250000 LastRapidFRO=1.000000
>> + 0 k: MPG shuttle mode terminated
>> + 0 k: CS0 state: shuttle_terminate (end)
>> + 0 k: t=0.403794 TimeExecuted=31.024153
>> TimeDownloaded=33.642973 TimeLost=0.000000
>> + 0 k: TimeBase=-0.132272us TimeBaseDelta=0.041021us
>> DecelTime=0.000001 TimeBaseDesired=-0.132272us
>> + 0 k: DoingRapid=0 Flushed=0 HoldAtEnd=0
>> NomDecel2TB2=12188868.000000
>> + 0 k: StoppingState=3 LastFRO=0.250000 LastRapidFRO=1.000000
>>
>> Note that CS0_TimeBase[Desired] seems to be left at a small negative
>> value, whether I shuttle forward or back. Maybe I should look at
>> StoppingState and force TimeBase to 0 based on that?
>>
>> If I do all of the above except that I do not actually rotate the
>> shuttle control, then it remembers the feed hold exactly and does
>> not creep forward. Also, CS0_StoppingState will be at 1 instead of
>> 3.
>>
>> Here is the log (at shuttle termination) for that case:
>>
>> + 0 k: CS0 state: shuttle_terminate (start)
>> + 1 k: t=0.000268 TimeExecuted=32.495906
>> TimeDownloaded=33.996697 TimeLost=0.000000
>> + 0 k: TimeBase=0.000000us TimeBaseDelta=8100.000020us
>> DecelTime=0.000001 TimeBaseDesired=0.000000us
>> + 0 k: DoingRapid=0 Flushed=0 HoldAtEnd=0
>> NomDecel2TB2=12188868.000000
>> + 0 k: StoppingState=1 LastFRO=0.250000 LastRapidFRO=1.000000
>> + 0 k: MPG shuttle mode terminated
>> + 0 k: CS0 state: shuttle_terminate (end)
>> + 0 k: t=0.000268 TimeExecuted=32.495906
>> TimeDownloaded=33.996697 TimeLost=0.000000
>> + 0 k: TimeBase=0.000000us TimeBaseDelta=0.041021us
>> DecelTime=0.000001 TimeBaseDesired=0.000000us
>> + 0 k: DoingRapid=0 Flushed=0 HoldAtEnd=0
>> NomDecel2TB2=12188868.000000
>> + 0 k: StoppingState=1 LastFRO=0.250000 LastRapidFRO=1.000000
>>
>> Rotating the shuttle control will call SetFROwRateTemp() in the
>> control loop. It seems that having a call to that function will
>> change the StoppingState from 1 to 3. That's the only obvious
>> difference I can see, along with TimeBase being set to exactly 0.
>>
>> Finally, regarding point (1) in the original message of this thread:
>> whatever I do, I seem to get an instant stop. I replaced the
>> SetFROTemp(0.);
>> with
>> SetFROwRateTemp(0., 0.3);
>>
>> but it still screeches to a halt. In the first console log snippet
>> above, you can see that the time base starts at 22.5 and ends at
>> 21.105. The delta is 0.041. Thus, it appears that exactly 34
>> increments have been applied. That's a bit surprising to me, but I
>> guess the printfs could have caused a long delay.
>>
>> Regards,
>>
>> SJH
>>
>> On Wed, Dec 14, 2016 at 3:55 PM, Tom Kerekes tk@...
>> [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
>>
>> Hi SJH,
>>
>> Sorry I missed that.
>>
>> I don't see anything obviously wrong. Please print out the FRO
>> values that you are setting on termination as well as all the
>> CS0_xxxx variables so we can understand what went wrong. Also the
>> CS0_xxx variables when the system is in the 1/100th speed mode?
>>
>> I also am having a hard time understanding your overall sequence of
>> events.
>>
>> Regards
>>
>> TK
>>
>> On 12/14/2016 2:56 PM, Hardy Family hardy.woodland.cypress@...
>> [DynoMotion] wrote:
>>
>> So any insight regarding this issue? I added some info in message 3
>> of this thread, but not sure whether it got through.
>>
>> Regards,
>> SJH
>
>
>
> Links:
> ------
> [1]
> https://groups.yahoo.com/neo/groups/DynoMotion/conversations/messages/15116;_ylc=X3oDMTJyaW91ZTQwBF9TAzk3MzU5NzE0BGdycElkAzE1ODU4MDAxBGdycHNwSWQDMTcwNjU1NDIwNQRtc2dJZAMxNTExNgRzZWMDZnRyBHNsawNycGx5BHN0aW1lAzE1MDk0MDg3MTM-?act=reply&messageNum=15116
> [2]
> https://groups.yahoo.com/neo/groups/DynoMotion/conversations/newtopic;_ylc=X3oDMTJmY2FwdGRtBF9TAzk3MzU5NzE0BGdycElkAzE1ODU4MDAxBGdycHNwSWQDMTcwNjU1NDIwNQRzZWMDZnRyBHNsawNudHBjBHN0aW1lAzE1MDk0MDg3MTM-
> [3]
> https://groups.yahoo.com/neo/groups/DynoMotion/conversations/topics/14250;_ylc=X3oDMTM3YjI4ODV0BF9TAzk3MzU5NzE0BGdycElkAzE1ODU4MDAxBGdycHNwSWQDMTcwNjU1NDIwNQRtc2dJZAMxNTExNgRzZWMDZnRyBHNsawN2dHBjBHN0aW1lAzE1MDk0MDg3MTMEdHBjSWQDMTQyNTA-
> [4] https://yho.com/1wwmgg
> [5]
> https://groups.yahoo.com/neo/groups/DynoMotion/info;_ylc=X3oDMTJmNnJhNnRkBF9TAzk3MzU5NzE0BGdycElkAzE1ODU4MDAxBGdycHNwSWQDMTcwNjU1NDIwNQRzZWMDdnRsBHNsawN2Z2hwBHN0aW1lAzE1MDk0MDg3MTM-
> [6]
> https://groups.yahoo.com/neo/groups/DynoMotion/members/all;_ylc=X3oDMTJnbDI4MGFmBF9TAzk3MzU5NzE0BGdycElkAzE1ODU4MDAxBGdycHNwSWQDMTcwNjU1NDIwNQRzZWMDdnRsBHNsawN2bWJycwRzdGltZQMxNTA5NDA4NzEz
> [7]
> https://groups.yahoo.com/neo;_ylc=X3oDMTJlcmk4Z29tBF9TAzk3NDc2NTkwBGdycElkAzE1ODU4MDAxBGdycHNwSWQDMTcwNjU1NDIwNQRzZWMDZnRyBHNsawNnZnAEc3RpbWUDMTUwOTQwODcxMw--
> [8] https://info.yahoo.com/privacy/us/yahoo/groups/details.html
> [9] https://info.yahoo.com/legal/us/yahoo/utos/terms/